﻿<!DOCTYPE html>
<html>
<head>
    <title>JS Operators Exercise 4</title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <h1>Check if number's third digit (right-to-left) is 7:</h1>
    <label for="input-number">Number:</label>
    <input type="number" id="input-number"/>
    <button onclick="checkNumber()">Check Number</button>
    <div id="js-console"></div>
    <script src="scripts/js-console.js"></script>
    <script>
        function checkNumber()
        {
            var num;
            num = jsConsole.readInteger("#input-number");

            if ((((num % 1000) - (num % 100)) / 100) == 7)
            {
                jsConsole.writeLine("third digit (right-to-left) is 7");
            }
            else
            {
                jsConsole.writeLine("third digit (right-to-left) is NOT 7");
            }
        }
    </script>
</body>
</html>